home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 05 Programming / KILCUR.TXT < prev    next >
Text File  |  2019-04-13  |  4KB  |  59 lines

  1. KILLCURSOR
  2.  
  3. By Arnold Solof
  4.  
  5.      "Killcursor" is a utility program designed to run simultaneously with your BASIC or machine language programs. It's purpose is to disable keys which, if
  6. entered, could result in bad data input. The bad data input could be simply the wrong data or, even worse, it could result in the computer locking up.
  7.      The problem keys are:
  8.           1. cursor up
  9.           2. cursor down
  10.           3. comma
  11.           4. colon
  12.           5. home
  13.           6. clr
  14.           7. commodore keys
  15.           8. control keys
  16.  
  17.      The problem situation is entering data using the BASIC INPUT command. When this statement is used in a program, the user sees a question mark, a blank
  18. space, and then the flashing cursor.
  19.      If either cursor up or cursor down are used, they are interpreted as characters input. They also move the cursor off the row where the question mark was
  20. placed. Then when the return key is hit to enter the response, the computer enters it into the variable (answer) originally requested, not in response to what
  21. you see on the screen. So in addition to entering garbage cursor characters, you may not be responding to the question the computer is asking.
  22.      In many cases this results in the input of a null string (""). If this is written to a data file, when it is later read back the program will crash. Since
  23. there is NEVER any reason to use cursor up or cursor down during BASIC INPUT, disabling the keys protects the user against these errors of input.
  24.      If a colon or comma are entered, they are interpreted as commands rather than characters and result in truncating (chopping off) anything that follows the
  25. colon or comma. This is useful if the requested input is sometheing like INPUT A$,B$. In this case it wants two inputs separated by commas. However 99% of the
  26. time only one input is requested at a time and the comma simply is a problem waiting to happen.
  27.  
  28. HOW THE PROGRAM WORKS:
  29.      From Direct Mode:
  30.           LOAD "KILLCURSOR",8,1
  31.  
  32.      The program loads at 49152 decimal (outside of BASIC) and is written entirely in Machine language for speed. The program is started by a SYS49152. If in
  33. direct mode you should then enter NEW to reset the BASIC pointers. This is not necesary if the program is loaded from another program which then uses the
  34. SYS49152 from program mode.
  35.      EG.  10 IF PEEK828=0THENPOKE828,1:LOAD "KILLCURSOR",8,1
  36.           20 SYS49152
  37.           30 REM REMAINDER OF YOUR BASIC PROGRAM
  38.  
  39.      IF UNABLE TO MODIFY A PROGRAM (EG. PROTECTED) THEN MAKE A BOOT PROGRAM.
  40.  
  41.           10 IFA=0THENA=1:LOAD"KILLCURSOR",8,1
  42.           20 SYS49152:CLR:LOAD"PROGRAM NAME",8,1
  43.           30 REM SAVE THIS UNDER A UNIQUE NAME (EG. BOOT)
  44.  
  45.      The program copies the 8K BASIC and the 8K Kernal operating systems to their respective underlying RAM areas at the same addresses. (Since one cannot
  46. change the values in the ROMS, it is necessary to modify copies of them.) It then inserts the number 255 ($FF) into the keyboard matrix decode table of the
  47. keys to be disabled. This number represents the value of "NO KEY PRESSED". It then places 53 in location 1 which tells the computer to look at the ram copies
  48. instead of the ROM. The last instruction RTS (return from subroutine) returns control to BASIC.
  49.      The program takes about 0.5 seconds to run. After it has been run one can instantly switch back and forth from the ROM or RAM operating systems.
  50.  
  51.      Direct mode: Run/Stop and Restore resets to ROM
  52.                   POKE1,53 tells the computer to look at the RAM system
  53.      
  54.      Program mode: POKE1,55  RESETS TO ROM
  55.                    POKE1,53  RESETS TO RAM
  56.  
  57.      The program source code is included here. Anyone wanting a copy is welcome. It can't be copied with a load and save command. Filcop, a Disk copier, or a
  58. machine language monitor must be used.
  59.